//
//  PKRadioDetailHeadView.m
//  PianKe
//
//  Created by lanou on 15/12/23.
//  Copyright © 2015年 KFC. All rights reserved.
//

#import "PKRadioDetailHeadView.h"

@implementation PKRadioDetailHeadView



-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.TopImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height * 2 / 3)];
        
      //  self.TopImageV.backgroundColor = [UIColor greenColor];
        [self addSubview:self.TopImageV];
        
        self.headImageV = [[UIImageView alloc] initWithFrame:CGRectMake(self.TopImageV.left + 20, self.TopImageV.bottom + 20, frame.size.height / 8, frame.size.height / 8)];
        self.headImageV.layer.cornerRadius = frame.size.height / 16 ;
        self.headImageV.layer.masksToBounds = YES; // 设置适应
        self.headImageV.backgroundColor = [UIColor blackColor];
        [self addSubview:self.headImageV];
        
        self.unamelabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headImageV.right + 10, self.headImageV.top + 10, 200, self.headImageV.height - 20)];
       // self.unamelabel.backgroundColor = [UIColor yellowColor];
        [self addSubview:self.unamelabel];
        
        self.descLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headImageV.left, self.headImageV.bottom + 10 , frame.size.width - 40 , frame.size.height - self.headImageV.bottom - 20)];
       // self.descLabel.backgroundColor = [UIColor greenColor];
        [self addSubview:self.descLabel];
        
        UIImageView *countImageV = [[UIImageView alloc] initWithFrame:CGRectMake(frame.size.width - 60 - 20 - 15, self.unamelabel.top, 15, 15)];
        countImageV.image = [UIImage imageNamed:@"shengyin"];
        [self addSubview:countImageV];
        
        self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(countImageV.right, self.unamelabel.top, 60, countImageV.height)];
        self.countLabel.font = [UIFont systemFontOfSize:11];
        //self.countLabel.backgroundColor = [UIColor greenColor];
        [self addSubview:self.countLabel];
        
    }
    
    return self;
}



// 重写setModel方法
-(void)setRadioInfoModel:(PKRadioModel *)radioInfoModel
{
    
    _radioInfoModel = radioInfoModel;
    
    self.unamelabel.text = radioInfoModel.uname;
    self.countLabel.text = [NSString stringWithFormat:@"%@",radioInfoModel.musicvisitnum];
    self.descLabel.text = radioInfoModel.desc;

    [self.headImageV sd_setImageWithURL:[NSURL URLWithString:radioInfoModel.icon] placeholderImage:nil];
    [self.TopImageV sd_setImageWithURL:[NSURL URLWithString:radioInfoModel.coverimg] placeholderImage:nil];

}



@end
